I need to make the pink div 100% browser height, height: 100vh doesn't work right, there's a scrollbar so it's like 105%...
html,
body {
width: 100%;
height: 100%;
color: white;
background-color: #002B5A;
margin: 0;
padding: 0;
direction: rtl;
}
#right {} #left {
min-height: 100%;
height: 100%;
background-color: #CA1F4B;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="right">
right
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-offset-1" id="left">
left
</div>
</div>
Nenad Vracar
122k16 gold badges160 silver badges184 bronze badges
asked Jun 2, 2016 at 9:05
odedta
2,4785 gold badges26 silver badges57 bronze badges
-
Add overflow hidden. MaybeThomas Andreè Wang– Thomas Andreè Wang2016年06月02日 09:07:43 +00:00Commented Jun 2, 2016 at 9:07
2 Answers 2
You need to set #right's height to 100%.
#right {
height:100%;
}
Because #left is a child of the #right element, it is only being 100% of the parent's height. As #right is only set to height:auto; by default, it wont be 100%.
html,
body {
width: 100%;
height: 100%;
color: white;
background-color: #002B5A;
margin: 0;
padding: 0;
direction: rtl;
}
#right {
height:100%;
}
#left {
min-height: 100%;
height: 100%;
background-color: #CA1F4B;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="right">
right
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-offset-1" id="left">
left
</div>
</div>
answered Jun 2, 2016 at 9:06
Albzi
15.6k6 gold badges49 silver badges67 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Albzi
No worries glad I could help! @odedta
Try removing the min-height and changing the height to vmax, vmin or vh.
#left {
height: 100vh;
background-color: #CA1F4B;
}
answered Jun 2, 2016 at 9:09
Michelle Ashwini
8985 gold badges14 silver badges28 bronze badges
Comments
default